import { Controller, Post, Body } from '@nestjs/common';
import { Public } from 'src/common/decorators/public.decorator';
import { SignInDto } from './dto/sign-in';
import { SignUpDto } from './dto/sign-up';
import { ApiTags, ApiOperation } from '@nestjs/swagger';
import { AuthorizationServiceUser } from './authorization.serviceUser';

@Controller('auth')
@ApiTags('用户身份认证')
export class AuthorizationControllerUser {
  constructor(
    private readonly authorizationServiceUser: AuthorizationServiceUser,
  ) {}

  @Public()
  @ApiOperation({ summary: '用户注册', description: '注册一个用户' })
  @Post('/user/signUp')
  user_signUp(@Body() signUp: SignUpDto) {
    return this.authorizationServiceUser.userSignUp(signUp);
  }

  @Public()
  @ApiOperation({ summary: '用户登陆', description: '登陆获取token值' })
  @Post('/user/signIn')
  user_signIn(@Body() signIn: SignInDto) {
    return this.authorizationServiceUser.userSignIn(signIn);
  }
}
